<{include file="element/inc_header.html"}>
 
<div class="main-container" id="main-container">
	<script type="text/javascript">
		try{ace.settings.check('main-container' , 'fixed')}catch(e){}
	</script>

	<div class="main-container-inner">
		<div class="page-content"> 
			<div class="row">
				<div class="col-xs-12">
					<!-- PAGE CONTENT BEGINS -->
					<div class="row"> 
						<div class="col-xs-12" style="margin: 5px 0px 10px 0px;">  
							<label>基本操作：</label>
							<div class="btn-group">
								<button data-toggle="dropdown" class="btn btn-info btn-sm dropdown-toggle">
									基本操作
									<span class="icon-caret-down icon-on-right"></span>
								</button>
								<ul class="dropdown-menu dropdown-info pull-right">
									<li>
										<a href="javascript:void(0)"><i class="icon-zoom-in bigger-130"></i>&nbsp;&nbsp;全部执行</a>
									</li>
									<li>
										<a href="javascript:void(0)"><i class="icon-pencil bigger-130"></i>&nbsp;&nbsp;执行选中</a>
									</li>
									<li class="divider"></li>
									<li>
										<a href="javascript:void(0)"><i class="icon-trash bigger-130"></i>&nbsp;&nbsp;取消执行</a>
									</li>
								</ul>
							</div>
							<a style="line-height: 26px;" href="/admin.php?c=order&amp;a=search" class="btn btn-xs bigger btn-yellow">
								<i class="icon-cog"></i>新建导出任务
							</a>  
								
							<!-- 顶部分布 -->	
							<ul class="pagination pull-right no-margin">
								<{$pager}>
							</ul>
						</div>
					</div>
					 
					<div class="table-responsive">
						<table id="sample-table-1" class="table table-striped table-bordered table-hover">
							<thead>
								<tr>
									<th class="center">
										<label>
											<input type="checkbox" class="ace ckt" data-list="ckl" />
											<span class="lbl"></span>
										</label>
									</th>
									<th>注释</th>
									<th>类型</th>
									<th>
										<i class="icon-time bigger-110 hidden-480"></i>
										详情
									</th> 
									<th>创建时间</th> 
									<th>完成时间</th> 
									<th>状态</th> 
									<th></th>
								</tr>
							</thead>

							<tbody> 
								<{foreach from=$dataList item=order }>

								<tr>
									<td class="center">
										<label>
											<input type="checkbox" class="ace ckl" />
											<span class="lbl"></span>
										</label>
									</td>
									 
									<td>
										<{$order.title}>
									</td>
									<td> 
										<{$order.modelname}><br />
										<{$order.tablename}>
									</td>
									<td> 
										<span class="label label-sm label-warning arrowed-in">SQL:</span>&nbsp;<{$order.sqlstr}><br />
										<span class="label label-sm label-info arrowed arrowed-righ">File:</span><{$order.filename}> 
									</td> 
									<td> 
										<{$order.createtime}> 
									</td> 
									<td> 
										<{$order.endtime}> 
									</td>  
									<td>
										<span class="label label-sm <{if $order.status == 2 }> label-info <{else}> label-warning <{/if}>"><{$order.statusStr}></span>
									</td> 
									<td>
										<div class="btn-group">
											<button data-toggle="dropdown" class="btn btn-info btn-sm dropdown-toggle">
												基本操作
												<span class="icon-caret-down icon-on-right"></span>
											</button>
											<ul class="dropdown-menu dropdown-info pull-right">
												<li>
													<a  data-id="<{$order.id}>" data-oper="doexport" href="javascript:void(0)" class="olinbtn"><i class="icon-zoom-in bigger-130"></i>&nbsp;&nbsp;执行导出</a>
												</li>
												<{if 2 eq $order.status }>
												<li class="divider"></li>
												<li>
													<a  data-id="<{$order.id}>" data-oper="download" data-url="<{$order.filename}>" href="javascript:void(0)" class="olinbtn"><i class="icon-share-alt bigger-130"></i>&nbsp;&nbsp;下载数据</a>
												</li>
												<li>
													<a  data-id="<{$order.id}>" data-oper="delfile" data-url="<{$order.filename}>" href="javascript:void(0)" class="olinbtn"><i class="icon-trash bigger-130"></i>&nbsp;&nbsp;删除文件</a>
												</li>
												<{/if}>
												<li class="divider"></li>
												<li>
													<a  data-id="<{$order.id}>" data-oper="deltask"  href="javascript:void(0)" class="olinbtn"><i class="icon-trash bigger-130"></i>&nbsp;&nbsp;删除任务</a>
												</li>
											</ul>
										</div>
									</td>
								</tr>
								<{/foreach}>  
							</tbody>
						</table>
					</div>
					<!-- 底部分布 -->			
					<div class="modal-footer no-margin-top">  
						<ul class="pagination pull-right no-margin">
							<{$pager}>
						</ul>
					</div>
						
				</div>
									
								 
  
			</div><!-- /.row --> 
		</div><!-- /.page-content --> 
  
	</div><!-- /.main-container -->
</div>
<{include file="element/js_lib.html"}>
<script language="javascript">
	jQuery(function(){
			$('.date-picker').datepicker({autoclose:true}).next().on(ace.click_event, function(){
					$(this).prev().focus();
				});
  
			$('table th input:checkbox').on('click' , function(){
					var that = this;
					$(this).closest('table').find('tr > td:first-child input:checkbox')
					.each(function(){ this.checked = that.checked; $(this).closest('tr').toggleClass('selected');
						});
						
				});
			$('.olinbtn').click(function(){
					var id = $(this).data('id');
					var oper = $(this).data('oper');
					if('download'==oper){
						window.open($(this).data('url'));
					}else if('doexport'==oper){
						$.getJSON('/admin.php?c=task&a=task_export&id='+id,function(d){
								alert(d.m);
								if(d.s){ location.reload();}
							});
					}else if('delfile'==oper){
						$.getJSON('/admin.php?c=task&a=del_file&id='+id,function(d){
								alert(d.m);
								if(d.s){ location.reload();}
							});
					}else if('deltask'==oper){
						$.getJSON('/admin.php?c=task&a=deltask&id='+id,function(d){
								alert(d.m);
								if(d.s){ location.reload();}
							});
					}
				});
		})
</script> 
